using Microsoft.Practices.CompositeWeb.ObjectBuilder;
using Microsoft.Practices.ObjectBuilder;

using WCSFContrib.Extensions.CompositeWeb.ObjectBuilder.Strategies;

namespace WCSFContrib.Extensions.CompositeWeb.ObjectBuilder
{
	public class WCSFBuilder : Microsoft.Practices.CompositeWeb.ObjectBuilder.WCSFBuilder
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="WCSFBuilder"/> class 
		/// </summary>
		public WCSFBuilder()
			: this(null)
		{ }

		/// <summary>
		/// Initializes a new instance of the <see cref="WCSFBuilder"/> class using the provided
		/// configurator and adds an EventBrokerStrategy for BuilderStage.PostInitialization.
		/// </summary>
		/// <param name="configurator">The configurator that will configure the builder.</param>
		public WCSFBuilder(IBuilderConfigurator<WCSFBuilderStage> configurator)
		{
			Strategies.AddNew<EventBrokerStrategy>(WCSFBuilderStage.PostInitialization);

			if (configurator != null)
			{
				configurator.ApplyConfiguration(this);
			}
		}
	}
}